//
//  HomeIconCollectionViewCell.m
//  翼安保
//
//  Created by duzhi on 2024/4/17.
//

#import "HomeIconCollectionViewCell.h"

@interface HomeIconCollectionViewCell ()

@property(nonatomic ,strong) UIImageView *icon;
@property(nonatomic ,strong) UILabel *titleL;

@end
@implementation HomeIconCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI {
    UIImageView *icon = [UIImageView new];
    [self.contentView addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(0);
        make.width.height.mas_equalTo(relativeWidth(40));
    }];
    self.icon = icon;
    
    UILabel *titleL = [UILabel new];
    titleL.font = [UIFont boldSystemFontOfSize:relativeWidth(14)];
    titleL.textColor = [UIColor blackColor];
    [self.contentView addSubview:titleL];
    [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(self.icon.mas_bottom).offset(relativeWidth(5));
        make.height.mas_equalTo(relativeWidth(20));
    }];
    self.titleL = titleL;
}

- (void)setModel:(HomeModel *)model {
    _model = model;
    self.icon.image = [UIImage imageNamed:model.icon];
    self.titleL.text = model.title;
}

@end
